/*
 * @Author: MMangoo
 * @Date: 2020-12-15 14:50:29
 * @LastEditors: MMangoo
 * @LastEditTime: 2021-03-21 21:48:45
 * @Description: file content
 */
import Vue from 'vue'
import VueRouter from 'vue-router'
import _fileImport from '@/utils/routerImport'
import Home from '../views/Home.vue'
Vue.use(VueRouter)
// 创建router数据routes
const routes = [
  {
    path: '/',
    name: 'home',
    component: Home
  },
  {
    path: '/uploadStudy',
    name: 'uploadStudy',
    component: _fileImport('uploadStudy')
  },
  {
    path: '/Image',
    name: 'Image',
    component: _fileImport('Image')
  },
  {
    path: '/thinkStudy',
    name: 'thinkStudy',
    component: _fileImport('thinkStudy')
  },
  {
    path: '/xyqSearch',
    name: 'xyqSearch',
    component: _fileImport('xyqSearch')
  },
  {
    path: '/writer',
    name: 'writer',
    component: _fileImport('qrCodeWriter')
  },
  {
    path: '/firstView',
    name: 'firstView',
    component: _fileImport('firstView')
  },
  {
    path: '/studyArray',
    name: 'studyArray',
    component: _fileImport('study/studyArray')
  },
  {
    path: '/studyEvenEmitter',
    name: 'studyEvenEmitter',
    component: _fileImport('study/studyEvenEmitter')
  },
  {
    path: '/eventLoop',
    name: 'eventLoop',
    component: _fileImport('study/eventLoop')
  },
  {
    path: '/arrayFuncStudy',
    name: 'arrayFuncStudy',
    component: _fileImport('study/arrayFuncStudy')
  },
  {
    path: '/letcode1',
    name: 'letcode1',
    component: _fileImport('study/letcode1')
  }
  // {
  //   //使用_fileImport引入router的方式，有趣
  //   path: '/qrCode',
  //   name: 'qrCode',
  //   component:_fileImport('common/MangoQrCode','components')
  // },

]
// 最后创建router 对路由进行管理，它是由构造函数 new vueRouter() 创建，接受routes 参数。
const router = new VueRouter({
  mode: 'hash',
  routes
})
router.beforeEach((to, from, next) => {

  next()
})
// 暴露出去
export default router
